home *** CD-ROM | disk | FTP | other *** search
- /**********************************************
- HTBclock.dll
- TransEra Corporation 1999.
- This is the source for the HTBClock.dll.
-
- ***********************************************/
- #include "stdafx.h"
- #include "HTBclock.h"
- #include "lockDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- #define FONT "Arial" // Supports all Windows Fonts
- #define TIME_FORMAT "%d:%0.2d:%0.2d" // formatting string for Time string
- #define X_SIZE 300
- #define Y_SIZE 150
- #define FONT_SIZE 500
- #define COLOR_MIN 0
- #define GREY_COLOR 240
- #define HOUR_FORMAT 12 // 12 or 24
- #define TIMERVAL 100
- #define OFFSET 3
- #define NEG_OFFSET -5
-
-
- ClockDlg::ClockDlg(CWnd* pParent /*=NULL*/)
- : CDialog(ClockDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(ClockDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
-
- void ClockDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ClockDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(ClockDlg, CDialog)
- //{{AFX_MSG_MAP(ClockDlg)
- ON_WM_PAINT()
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // ClockDlg message handlers
-
- BOOL ClockDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- SetWindowPos(FromHandle(m_hWnd), g_Xpos, g_Ypos, X_SIZE, Y_SIZE, SWP_NOZORDER);
- SetTimer(1,TIMERVAL,NULL);
- return TRUE;
- }
-
- void ClockDlg::OnTimer(UINT nIDEvent)
- {
- Invalidate();
- CDialog::OnTimer(nIDEvent);
- }
-
- void ClockDlg::OnPaint()
- {
-
- CPaintDC dc(this);
- CRect rect;
- GetClientRect(&rect);
- CFont font;
- font.CreatePointFont(FONT_SIZE,_T(FONT));
- dc.SelectObject(&font); // Load Font
- dc.SetBkMode(TRANSPARENT); // Background
- CString sCurTime;
- CTime time = CTime::GetCurrentTime();
- int iSecond = time.GetSecond();
- int iMinute = time.GetMinute();
- int iHour = time.GetHour() % HOUR_FORMAT;
- sCurTime.Format(_T(TIME_FORMAT), iHour, iMinute, iSecond);
- rect.OffsetRect(OFFSET, OFFSET);
- dc.SetTextColor(RGB(GREY_COLOR, GREY_COLOR, GREY_COLOR));
- dc.DrawText(sCurTime, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
- rect.OffsetRect(NEG_OFFSET, NEG_OFFSET);
- dc.SetTextColor(RGB(COLOR_MIN, COLOR_MIN, COLOR_MIN));
- dc.DrawText(sCurTime, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
- }
-
-
-